Skip to main content

FormWrapper

A common component to wrap forms in that handles error states of each field

NameTypeDefault ValueRequiredDescription
fieldsListFormFieldType<T>[]Yeslist of form field objects to display
onSave() => voidYescallback called when onSaveClicked is true and there are no field errors
onSaveClickedbooleanYesboolean that when set to true calls the form validation and set field errors if they exist, otherwise it calls onSave
setOnSaveClicked(value: boolean) => voidYescallback that updates the onSaveClicked prop
setFormContainsError(containsError: boolean) => voidNooptional callback that sets to true if the form currently has an error
resetErrorsbooleanNooptional boolean that resets all field errors when set to true
setResetErrors(value: boolean) => voidNooptional callback to set the resetErrors prop. must be set when resetErrors is set.
setErrorList(errors: { [key: number]: string; }) => voidNooptional callback to return a list of errors and keys for alertBox functionality